#ifndef SILIB_H
#define SILIB_H

#include "myLib.h"
#include "startScreen.h"
#include "win.h"
#include "loser.h"
/*
Kyle Kelly
HW9
CS2110-B2
*/

#define SPACESHIP_INIT_COL  (110)
#define SPACESHIP_INIT_ROW  (135)
#define SHIPH (12)
#define SHIPW (20)
#define BULLETHW (2)
#define MAX_PLAYER_BULLETS  (6)
#define INIT_INVADERS (24)
#define INVADERS_PER_ROW (8)
#define INIT_LIVES (3)
#define INVADERH (8)
#define INVADERW (6)
#define INVADER_START_R (3)
#define INVADER_START_C (10)
#define INVADER_BUFFER (10)

typedef enum ObjStatus {ALIVE, DEAD} objStatus;
typedef enum BulletStatus {FIRED, UNFIRED} bulletStatus;

typedef struct bullet
{
	volatile int r;
	volatile int c;
	bulletStatus status;
} Bullet;

typedef struct ship
{
	volatile int r;
	volatile int c;
	int bulletsLeft;
	objStatus status;
	Bullet bullets[MAX_PLAYER_BULLETS];
} Ship;

typedef struct invader
{
	volatile int r;
	volatile int c;
	objStatus status;
	Bullet bullet;
}	Invader;

/*Global vars*/
extern Ship ship;
extern u32 lives;
extern Invader invaders[];

/*Prototypes*/
void newGame();
void invadersTryFire();
void playerFire();
int waitForStart();
void moveLeft();
void moveRight();
void updateBullets();
void drawInvaders();
void updateInvaders();
void genShip();
void genInvaders();
void checkCollisions();
void checkWinConditions();
void checkLoseConditions();

#endif
